start();
var awardArr,humanArr,resultArr,timer,timer1;

var i=0;
var j=0;
var flag=0;
function start(){
  awardArr = new Array();
  humanArr = new Array();
  resultArr = new Array();
	var award=document.getElementById("award");
	var human = document.getElementById("human");
}
function add(){
	var inputAward = document.getElementById("inputAward");
	var a=inputAward.value.split("，");
	var human = document.getElementById("inputHuman");
	var b=human.value.split("，");
	for(var i=0;i<a.length;i++){
		for(var j=0;j<awardArr.length;j++){
			if(a[i]===awardArr[j]){
				flag=1;
			}
		}
		if(flag != 1){
			awardArr.push(a[i]);			
		}else{
			flag = 0;
		}
	}
	
	for(var i=0;i<b.length;i++){
		for(var j=0;j<humanArr.length;j++){
			if(b[i]===humanArr[j]){
				flag=1;
			}
		}
		if(flag != 1){
			humanArr.push(b[i]);			
		}else{
			flag = 0;
		}
	}
}
function intervalAward(){
	//console.log(awardArr[i]);
	i = i+1;
	if(i == awardArr.length){
		i=0;
	}
	award.innerText=awardArr[i];
}
function intervalHuman(){
	j = j+1;
	if(j == humanArr.length){
		j=0;
	}
	human.innerText=humanArr[j];
}
function begin(){

	clearInterval(timer);
	clearInterval(timer1);
	timer=setInterval("intervalAward()",150);
	timer1=setInterval("intervalHuman()",200);
	console.log(awardArr.length);
	console.log(awardArr[0]);
}
function over(){
	var s = parseInt(Math.random()*awardArr.length,10);
	clearInterval(timer);
	clearInterval(timer1);
	award.innerText=awardArr[s];
	resultArr[0]=human.innerText;
	resultArr[1]=award.innerText;
	alert("奖品："+resultArr[1]+"  中奖人:"+resultArr[0])
}